#include "transmit.h"

Status sendStatus(int fd, const Status* buf) {
	if (send(fd, buf, sizeof(Status), 0) == -1) {
		SEND_ERR;
		return Failure;
	}
	return Success;
}

Status recvStatus(int fd, Status* buf) {
	if (recv(fd, buf, sizeof(Status), 0) == -1) {
		RECV_ERR;
		return Failure;
	}
	return Success;
}

Status sendStaff(int fd, const StaffMsg* buf) {
	if (send(fd, buf, sizeof(StaffMsg), 0) == -1) {
		SEND_ERR;
		return Failure;
	}
	return Success;
}

Status recvStaff(int fd, StaffMsg* buf) {
	if (recv(fd, buf, sizeof(StaffMsg), 0) == -1) {
		RECV_ERR;
		return Failure;
	}
	return Success;
}

Status sendLogin(int fd, const LoginMsg* buf) {
	if (send(fd, buf, sizeof(LoginMsg), 0) == -1) {
		SEND_ERR;
		return Failure;
	}
	return Success;
}

Status recvLogin(int fd, LoginMsg* buf) {
	if (recv(fd, buf, sizeof(LoginMsg), 0) == -1) {
		RECV_ERR;
		return Failure;
	}
	return Success;
}

Status sendHistory(int fd, const HistoryMsg* buf) {
	if (send(fd, buf, sizeof(HistoryMsg), 0) == -1) {
		SEND_ERR;
		return Failure;
	}
	return Success;
}

Status recvHistory(int fd, HistoryMsg* buf) {
	if (recv(fd, buf, sizeof(HistoryMsg), 0) == -1) {
		RECV_ERR;
		return Failure;
	}
	return Success;
}

